new Vue({
	el: "body",
	data: {
		joblist: {

		},
		objlist: [],
		isxx: false, //有无记录
	},
	methods: {

	},
	created: function() {
		init();
		var currentUser = AV.User.current();
		if(currentUser) {} else {
			location.href = "../loginAndReg/login.html"
		}
		var city = get(geturlitem(location.search, "city"));
		var jobtype = get(geturlitem(location.search, "jobtype"));
		var industry = get(geturlitem(location.search, "industry"));
		//		console.log(city+jobtype+industry);
		var _this = this;

		
		var userid = currentUser.id; //获取用户id
		
		var query = new AV.Query('collection');
		query.equalTo('userid', userid);

		query.find().then(function(success) {
			console.log(success);
			if(success.length == 0) {
				_this.isxx = true;
			}
			var arr = [];
			for(var i = 0; i < success.length; i++) {
				arr.push(success[i].attributes.objectid);
			}
			_this.objlist = arr;
		}).then(function() {
			var query1 = new AV.Query('position');

			var comarr = [];
			for(var j = 0; j < _this.objlist.length; j++) {
				console.log(_this.objlist[j])
				query1.get(_this.objlist[j]).then(function(success) {

					var p = {
						attributes: success.attributes,
						id: success.id
					}
					comarr.push(p);
					_this.joblist = comarr;
					console.log(_this.joblist);
				}).catch(function(error) {
					console.log(JSON.stringify(error));
				});
			}
		}).catch(function(error) {
			console.log(JSON.stringify(error));
		});

	}
})